<template>
  <b-ace-editor v-model="content" height="80%" lang="yaml" snippets></b-ace-editor>
</template>
<script>
import { ref } from "vue";
export default {
  name: 'YamlEdit',
  components: {},
  setup() {
    const content = ref(``);

    return {
      content,
      async loadYaml(kind, namespace, name) {
        if (kind == "Node" || kind == "StorageClass" || kind =="PersistentVolume" ) {
          let yaml = await window["k8s_Get" + kind + "Yaml"](name)
         
          content.value = yaml
        } else {
          let yaml = await window["k8s_Get" + kind + "Yaml"](namespace, name)
         
          content.value = yaml
        }
      }
    };
  },
}
</script>
